<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [{
            name: "张三",
            id: 1
        }, {
            name: "张三",
            id: 2
        }, {
            name: "张三",
            id: 3
        }, {
            name: "张三",
            id: 4
        }, {
            name: "张三",
            id: 5
        }];

        // let res = arr.filter(function (item) {
        //    return item.id !== 2
        // })

        let index = arr.findIndex(item => item.id == 2)
        arr.splice(index, 1)

        console.log(arr)
    </script>
</body>

</html>